package jmvm.schemes;

import java.awt.Point;
import java.util.ArrayList;

import jmvm.components.*;
import jmvm.gui.GuiLine;
import jmvm.gui.GuiScheme;


public class UpravUprav {
	
	
	public static DC dc; 		// Izlazi ovog dekodera predstavljaju signale bradr, bropr, ....
	
	public static OR brcnd;
	
	public static OR branch;
	
	public static AND and0, and1, and2, and3, and4, and5, and6, and7, and8, and9, and10, and11, and12,
	and13, and14, and15, and16, and17, and18, and19;
	
	////////////
	//////////// Grafika
	////////////
	
	public static GuiScheme gui;

	public static GuiScheme getGui() {
		return gui;
	}
	
	public static void gui() {

		GuiLine line; // Pomocna promenljiva
		gui = new GuiScheme("jmvm/jmvm/images/UpravUprav.png");
		
		ArrayList<ArrayList<Point>> sections;
		ArrayList<Point> points;
		
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(60,441));
		points.add(new Point(82,441));
		sections.add(points);
		line=new GuiLine(sections,UpravljackaJedinica.CW_8_15Bits.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(60,454));
		points.add(new Point(82,454));
		sections.add(points);
		line=new GuiLine(sections,UpravljackaJedinica.CW_8_15Bits.getOut(1));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(60,469));
		points.add(new Point(81,469));
		sections.add(points);
		line=new GuiLine(sections,UpravljackaJedinica.CW_8_15Bits.getOut(2));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(60,483));
		points.add(new Point(82,483));
		sections.add(points);
		line=new GuiLine(sections,UpravljackaJedinica.CW_8_15Bits.getOut(3));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(60,497));
		points.add(new Point(82,497));
		sections.add(points);
		line=new GuiLine(sections,UpravljackaJedinica.CW_8_15Bits.getOut(4));
		gui.addLine(line);

		//
		//
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,260));
		points.add(new Point(230,260));
		points.add(new Point(230,26));
		points.add(new Point(655,26));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(1));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,275));
		points.add(new Point(240,275));
		points.add(new Point(240,48));
		points.add(new Point(390,48));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(2));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(147,289));
		points.add(new Point(249,289));
		points.add(new Point(249,86));
		points.add(new Point(390,86));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(3));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,304));
		points.add(new Point(259,304));
		points.add(new Point(259,124));
		points.add(new Point(390,124));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(4));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,319));
		points.add(new Point(268,319));
		points.add(new Point(268,162));
		points.add(new Point(389,162));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(5));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(147,332));
		points.add(new Point(278,332));
		points.add(new Point(278,199));
		points.add(new Point(390,199));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(6));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,347));
		points.add(new Point(287,347));
		points.add(new Point(287,237));
		points.add(new Point(390,237));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(7));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,363));
		points.add(new Point(297,363));
		points.add(new Point(297,275));
		points.add(new Point(390,275));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(8));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,375));
		points.add(new Point(306,375));
		points.add(new Point(306,313));
		points.add(new Point(390,313));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(9));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,390));
		points.add(new Point(315,390));
		points.add(new Point(315,351));
		points.add(new Point(390,351));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(10));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,407));
		points.add(new Point(325,407));
		points.add(new Point(325,388));
		points.add(new Point(390,388));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(11));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,426));
		points.add(new Point(390,426));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(12));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,438));
		points.add(new Point(326,438));
		points.add(new Point(326,464));
		points.add(new Point(390,464));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(13));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,451));
		points.add(new Point(316,451));
		points.add(new Point(316,503));
		points.add(new Point(390,502));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0xE));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,466));
		points.add(new Point(306,466));
		points.add(new Point(306,540));
		points.add(new Point(391,540));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0xF));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(149,479));
		points.add(new Point(297,479));
		points.add(new Point(297,577));
		points.add(new Point(390,577));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x10));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(149,494));
		points.add(new Point(287,494));
		points.add(new Point(287,615));
		points.add(new Point(390,615));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x11));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,506));
		points.add(new Point(278,506));
		points.add(new Point(278,653));
		points.add(new Point(390,653));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x12));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(149,521));
		points.add(new Point(268,521));
		points.add(new Point(268,691));
		points.add(new Point(390,691));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x13));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,536));
		points.add(new Point(257,536));
		points.add(new Point(257,728));
		points.add(new Point(390,728));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x14));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(149,549));
		points.add(new Point(249,549));
		points.add(new Point(249,766));
		points.add(new Point(390,766));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x15));
		gui.addLine(line);

		//
		//
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(381,60));
		points.add(new Point(386,60));
		sections.add(points);
		line=new GuiLine(sections,Exec2.START());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,98));
		points.add(new Point(389,98));
		sections.add(points);
		line=new GuiLine(sections,Bus.hack());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,135));
		points.add(new Point(386,135));
		sections.add(points);
		line=new GuiLine(sections,Bus.fcCPU());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(381,173));
		points.add(new Point(386,173));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.OR_gropr.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,211));
		points.add(new Point(389,211));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.OR_l1.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,249));
		points.add(new Point(386,249));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.AND_gradr.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,287));
		points.add(new Point(390,287));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.OR_l2_brnch.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,324));
		points.add(new Point(389,324));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.AND_l2_arlog.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,362));
		points.add(new Point(389,362));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.OR_l3_jump.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,400));
		points.add(new Point(389,400));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.AND_l3_arlog.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,438));
		points.add(new Point(389,438));
		sections.add(points);
		line=new GuiLine(sections,Fetch3.OR_store.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(383,476));
		points.add(new Point(389,476));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.LDW());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,513));
		points.add(new Point(389,513));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.regdir());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,551));
		points.add(new Point(386,551));
		sections.add(points);
		line=new GuiLine(sections,Exec4.brpom());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,589));
		points.add(new Point(386,589));
		sections.add(points);
		line=new GuiLine(sections,Intr1.prekid());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,627));
		points.add(new Point(386,627));
		sections.add(points);
		line=new GuiLine(sections,Intr1.PRINS());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,665));
		points.add(new Point(386,665));
		sections.add(points);
		line=new GuiLine(sections,Intr1.PRCOD());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,702));
		points.add(new Point(386,702));
		sections.add(points);
		line=new GuiLine(sections,Intr1.PRADR());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,740));
		points.add(new Point(386,740));
		sections.add(points);
		line=new GuiLine(sections,Intr1.PRINM());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(382,778));
		points.add(new Point(386,778));
		sections.add(points);
		line=new GuiLine(sections,Intr2.printr());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,54));
		points.add(new Point(654,54));
		sections.add(points);
		line=new GuiLine(sections,and0.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,92));
		points.add(new Point(654,92));
		sections.add(points);
		line=new GuiLine(sections,and1.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,130));
		points.add(new Point(654,130));
		sections.add(points);
		line=new GuiLine(sections,and2.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,167));
		points.add(new Point(653,167));
		sections.add(points);
		line=new GuiLine(sections,and3.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,205));
		points.add(new Point(654,205));
		sections.add(points);
		line=new GuiLine(sections,and4.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,243));
		points.add(new Point(654,243));
		sections.add(points);
		line=new GuiLine(sections,and5.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,281));
		points.add(new Point(654,281));
		sections.add(points);
		line=new GuiLine(sections,and6.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,319));
		points.add(new Point(654,319));
		sections.add(points);
		line=new GuiLine(sections,and7.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,356));
		points.add(new Point(654,356));
		sections.add(points);
		line=new GuiLine(sections,and8.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,394));
		points.add(new Point(654,394));
		sections.add(points);
		line=new GuiLine(sections,and9.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,432));
		points.add(new Point(654,432));
		sections.add(points);
		line=new GuiLine(sections,and10.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,470));
		points.add(new Point(654,470));
		sections.add(points);
		line=new GuiLine(sections,and11.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,507));
		points.add(new Point(654,507));
		sections.add(points);
		line=new GuiLine(sections,and12.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,545));
		points.add(new Point(655,545));
		sections.add(points);
		line=new GuiLine(sections,and13.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,583));
		points.add(new Point(654,583));
		sections.add(points);
		line=new GuiLine(sections,and14.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,621));
		points.add(new Point(654,621));
		sections.add(points);
		line=new GuiLine(sections,and15.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,659));
		points.add(new Point(654,659));
		sections.add(points);
		line=new GuiLine(sections,and16.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(414,696));
		points.add(new Point(654,696));
		sections.add(points);
		line=new GuiLine(sections,and17.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,734));
		points.add(new Point(654,734));
		sections.add(points);
		line=new GuiLine(sections,and18.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(413,772));
		points.add(new Point(654,772));
		sections.add(points);
		line=new GuiLine(sections,and19.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,564));
		points.add(new Point(171,564));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x16));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(148,579));
		points.add(new Point(171,579));
		sections.add(points);
		line=new GuiLine(sections,dc.getOut(0x17));
		gui.addLine(line);

		//
		//
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(677,414));
		points.add(new Point(715,414));
		sections.add(points);
		line=new GuiLine(sections,branch.getOut(0));
		gui.addLine(line);

		//
		//




	}
	/////////////
	/////////////
	/////////////
	
	public static void init(){
		
		dc = new DC(5);	
		
		brcnd = new OR(20);
		
		and0 = new AND();
		and1 = new AND();
		and2 = new AND();
		and3 = new AND();
		and4 = new AND();
		and5 = new AND();
		and6 = new AND();
		and7 = new AND();
		and8 = new AND();
		and9 = new AND();
		and10 = new AND();
		and11 = new AND();
		and12 = new AND();
		and13 = new AND();
		and14 = new AND();
		and15 = new AND();
		and16 = new AND();
		and17 = new AND();
		and18 = new AND();
		and19 = new AND();
		
		branch = new OR();
		
	}
	
	public static void connect(){
				
		dc.setInputPin(0, UpravljackaJedinica.CW_8_15Bits.getOut(0));
		dc.setInputPin(1, UpravljackaJedinica.CW_8_15Bits.getOut(1));
		dc.setInputPin(2, UpravljackaJedinica.CW_8_15Bits.getOut(2));
		dc.setInputPin(3, UpravljackaJedinica.CW_8_15Bits.getOut(3));
		dc.setInputPin(4, UpravljackaJedinica.CW_8_15Bits.getOut(4));
		
		
		and0.setInputPin(0, brnotstart());
		and0.setInputPin(1, Exec2.not_start());
		
		and1.setInputPin(0, brhack());
		and1.setInputPin(1, Bus.hack());
		
		and2.setInputPin(0, brnotfcCPU());
		and2.setInputPin(1, Bus.not_fcCPU());
		
		and3.setInputPin(0, brnotgropr());
		and3.setInputPin(1, Fetch3.not_gropr());
		
		and4.setInputPin(0, brl1());
		and4.setInputPin(1, Fetch3.l1());
		
		and5.setInputPin(0, brnotgradr());
		and5.setInputPin(1, Fetch3.not_gradr());
		
		and6.setInputPin(0, brl2_brnch());
		and6.setInputPin(1, Fetch3.l2_brnch());
		
		and7.setInputPin(0, brl2_arlog());
		and7.setInputPin(1, Fetch3.l2_arlog());
		
		and8.setInputPin(0, brl3_jump());
		and8.setInputPin(1, Fetch3.l3_jump());
		
		and9.setInputPin(0, brl3_arlog());
		and9.setInputPin(1, Fetch3.l3_arlog());
		
		and10.setInputPin(0, brstore());
		and10.setInputPin(1, Fetch3.store());
		
		and11.setInputPin(0, brLDW());
		and11.setInputPin(1, Fetch2.LDW());
		
		and12.setInputPin(0, brregdir());
		and12.setInputPin(1, Fetch2.regdir());
		
		and13.setInputPin(0, brnotbrpom());
		and13.setInputPin(1, Exec4.not_brpom());
		
		and14.setInputPin(0, brnotprekid());
		and14.setInputPin(1, Intr1.not_prekid());
		
		and15.setInputPin(0, brnotPRINS());
		and15.setInputPin(1, Intr1.not_PRINS());
		
		and16.setInputPin(0, brnotPRCOD());
		and16.setInputPin(1, Intr1.not_PRCOD());
		
		and17.setInputPin(0, brnotPRADR());
		and17.setInputPin(1, Intr1.not_PRADR());
		
		and18.setInputPin(0, brnotPRINM());
		and18.setInputPin(1, Intr1.not_PRINM());
		
		and19.setInputPin(0, brnotprintr());
		and19.setInputPin(1, Intr2.not_printr());
		
		brcnd.setInputPin(0, and0.getOut(0));
		brcnd.setInputPin(1, and1.getOut(0));
		brcnd.setInputPin(2, and2.getOut(0));
		brcnd.setInputPin(3, and3.getOut(0));
		brcnd.setInputPin(4, and4.getOut(0));
		brcnd.setInputPin(5, and5.getOut(0));
		brcnd.setInputPin(6, and6.getOut(0));
		brcnd.setInputPin(7, and7.getOut(0));
		brcnd.setInputPin(8, and8.getOut(0));
		brcnd.setInputPin(9, and9.getOut(0));
		brcnd.setInputPin(10, and10.getOut(0));
		brcnd.setInputPin(11, and11.getOut(0));
		brcnd.setInputPin(12, and12.getOut(0));
		brcnd.setInputPin(13, and13.getOut(0));
		brcnd.setInputPin(14, and14.getOut(0));
		brcnd.setInputPin(15, and15.getOut(0));
		brcnd.setInputPin(16, and16.getOut(0));
		brcnd.setInputPin(17, and17.getOut(0));
		brcnd.setInputPin(18, and18.getOut(0));
		brcnd.setInputPin(19, and19.getOut(0));
		
		branch.setInputPin(0, brcnd.getOut(0));
		branch.setInputPin(1, dc.getOut(1));
		
	}
	

	public static Pin bradr() {
		return dc.getOut(22);
	}

	public static Pin bropr() {
		return dc.getOut(23);
	}

	public static Pin bruncnd() {
		return dc.getOut(1);
	}

	public static Pin brcnd() {
		return brcnd.getOut(0);
	}

///////////////////////////////////////////////
	
	public static Pin brnotstart() {
		return dc.getOut(2);
	}
	
	public static Pin brhack() {
		return dc.getOut(3);
	}
	
	public static Pin brnotfcCPU() {
		return dc.getOut(4);
	}
	
	public static Pin brnotgropr() {
		return dc.getOut(5);
	}
	
	public static Pin brl1() {
		return dc.getOut(6);
	}
	
	public static Pin brnotgradr() {
		return dc.getOut(7);
	}
	
	public static Pin brl2_brnch() {
		return dc.getOut(8);
	}
	
	public static Pin brl2_arlog() {
		return dc.getOut(9);
	}
	
	public static Pin brl3_jump() {
		return dc.getOut(10);
	}
	
	public static Pin brl3_arlog() {
		return dc.getOut(11);
	}
	
	public static Pin brstore() {
		return dc.getOut(12);
	}
	
	public static Pin brLDW() {
		return dc.getOut(13);
	}
	
	public static Pin brregdir() {
		return dc.getOut(14);
	}
	
	public static Pin brnotbrpom() {
		return dc.getOut(15);
	}
	
	public static Pin brnotprekid() {
		return dc.getOut(16);
	}
	
	public static Pin brnotPRINS() {
		return dc.getOut(17);
	}
	
	public static Pin brnotPRCOD() {
		return dc.getOut(18);
	}
	
	public static Pin brnotPRADR() {
		return dc.getOut(19);
	}
	
	public static Pin brnotPRINM() {
		return dc.getOut(20);
	}
	
	public static Pin brnotprintr() {
		return dc.getOut(21);
	}
}
